using System;
using UnityEngine;

namespace Function.SkillEditor.Runtime
{
    [Serializable]
    public class SkillAnimatorClip : SkillClip
    {
        [SerializeField] public int _layer;

        public override void Render(RenderState renderState, IClipRenderEnv renderEnvEnv)
        {
            if (renderState == RenderState.Enter)
            {
                AnimatorRender.Play(renderEnvEnv._animator, _asset as AnimationClip, _layer, 0,
                    SkillRunMap.Instance.GetSpeed());
            }
        }

        public override void OnEnter()
        {
            SkillRunRender.Instance.SendMessage(_entityData._entityId, RenderState.Enter, this);
        }
    }
}